package com.tdu.cn.Life;
/*
 * 这个类用来演示Baen的生命周期
 */

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;

@Component
public class Life01 implements Life{

    private String name;

    public Life01() {
        System.out.println("1 无参构造实例化");
    }

    @Value("老师在脱裤子放屁")
    public void setName(String name) {
        this.name = name;
        System.out.println("2 set方法赋值");
    }

    @PostConstruct
    public void init() {
        System.out.println("3 初始化方法");
    }

    @PreDestroy
    public void destroy() {
        
        System.out.println("5 销毁时需要做什么事");
    }
    
}
